// EnterEdit.cpp : implementation file
//

#include "stdafx.h"
#include "EnterEdit.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


static UINT UWM_EDIT_COMPLETE = ::RegisterWindowMessage(UWM_EDIT_COMPLETE_MSG);

/////////////////////////////////////////////////////////////////////////////
// CEnterEdit

CEnterEdit::CEnterEdit()
{
}

CEnterEdit::~CEnterEdit()
{
}


BEGIN_MESSAGE_MAP(CEnterEdit, CEdit)
	//{{AFX_MSG_MAP(CEnterEdit)
	ON_CONTROL_REFLECT(EN_KILLFOCUS, OnKillfocus)
	ON_WM_GETDLGCODE()
	ON_WM_CHAR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CEnterEdit message handlers

void CEnterEdit::OnKillfocus() 
   {
    GetParent()->SendMessage(UWM_EDIT_COMPLETE, GetDlgCtrlID(), (LPARAM)this);	
   }

UINT CEnterEdit::OnGetDlgCode() 
   {
    return CEdit::OnGetDlgCode() | DLGC_WANTALLKEYS;
   }

void CEnterEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
   {
    switch(nChar)
       { /* nChar */
	case VK_RETURN:
	   GetParent()->SendMessage(UWM_EDIT_COMPLETE, GetDlgCtrlID(), (LPARAM)this);
	   return;
       } /* nChar */
    CEdit::OnChar(nChar, nRepCnt, nFlags);
   }

